﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class library
    {
        //编号、书名、价格、出版社、作者信息
        public int ID { get; set; }
        public string book { get; set; }

        public int price
        {
            get { return price; }
            set
            {
                //小于0价格，赋值为0
                if (value < 0)
                {
                    price = 0;
                }
                else {
                    price = value;
                }
            }
        }
        public library(int id, string book, int price) {
            this.ID = id;
            this.book = book;
            this.price = price;

        }

        public void print() {
            Console.WriteLine($"ID:{this.ID}书名：{this.book}价格：{this.price}");
        }
    }
}
